<template>
	<div class="cart_page" id="cartData">
		<header v-if="cartCount>0">
			<span class="qh_yellow r14 pl5">已选择检测项目</span>
		</header>
			<div class="cart_items mb10" v-for="panel in cart">
				<div class="item_header qh_yellow">
					<span class="r11">{{panel.name}}</span>
					<a class="qh_yellow edit yellow_link r12 delete_btn"   style="margin-right:0.2rem;" v-on:click="deleteCart(panel)">删除</a>
				</div>
			</div>
		<div class="cart_empty" v-if="cartCount==0">
			<img src="../../../assets/empty_cart.png" style="width:50%;">
		</div>
		<div style="height: .84rem;"></div>
		<div class="cart_submit">
			<ul class="mb0">
				<router-link v-if="cartCount>0" to="/mall" tag="li"><span>继续购物</span></router-link><li v-if="cartCount>0"><span>马上下单</span></li>
				<router-link to="/mall" tag="li" v-if="cartCount==0" id="goShopInEmpty">
				<span>继续购物</span>
				</router-link>
			</ul>
		</div>
	</div>
</template>
<script>
	import { mapGetters, mapActions } from 'vuex'
	import './cart.less'
	
	export default {
		computed: mapGetters({
			cartCount: 'cartCount',
			cart: 'cart'
		}),
		methods: {
			...mapActions([
			    'deleteCart'
			]),
		},
		created (){
			this.$store.dispatch( 'getCarts' );
		}
	}
</script>




